package com.bwie.controller;

import com.bwie.pojo.TbCoupon;
import com.bwie.service.TbCouponService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2025/7/8 15:07
 */

@RestController
@RequestMapping(("/win/coupon"))
public class CouponController {

    @Autowired
    TbCouponService couponService;

    /**
     * @description 分页获取优惠券列表
     * @params [pageInfoVo]
     * @return com.bwie.utils.R
     * @author 军哥
     * @date 2025/7/8 15:10
     */
    @PostMapping("/getCouponList")
    public R getCouponList(@RequestBody PageInfoVo pageInfoVo) {
        return couponService.getCouponList(pageInfoVo);
    }

    /**
     * @description 添加优惠券
     * @params [tbCoupon]
     * @return com.bwie.utils.R
     * @author 军哥
     * @date 2025/7/9 14:30
     */
    @PostMapping("/addCoupon")
    public R addCoupon(@RequestBody TbCoupon tbCoupon) {
        return couponService.addCoupon(tbCoupon);
    }

    /**
     * @description 复制优惠券
     * @params [couponId]
     * @return com.bwie.utils.R
     * @author 军哥
     * @date 2025/7/9 17:22
     */
    @PostMapping("/copyCoupon/{couponId}")
    public R copyCoupon(@PathVariable("couponId") Integer couponId) {
        return couponService.copyCoupon(couponId);
    }

}
